#include <gtest/gtest.h>
#include <vector>

using namespace ::std;

class Solution {
public:
    void moveZeroes(vector<int>& nums);
};

void Solution::moveZeroes(vector<int>& nums) {
    int nonZeroCnt = 0;
    for(int index = 0; index < nums.size(); ++index) {
        if(nums[index] != 0) nums[nonZeroCnt++] = nums[index];
    }
    while(nonZeroCnt < nums.size()) nums[nonZeroCnt++] = 0;
}

class MoveZeroesMaxAreaCheck : public ::testing::Test {
public:
	class Solution solution;
};

TEST_F(MoveZeroesMaxAreaCheck, testMaxArea_1) {
    vector<int> nums = {0,1,0,3,12};
    solution.moveZeroes(nums);
    EXPECT_TRUE(vector<int>({1,3,12,0,0}) == nums);
}

TEST_F(MoveZeroesMaxAreaCheck, testMaxArea_2) {
    vector<int> nums = {0};
    solution.moveZeroes(nums);
    EXPECT_TRUE(vector<int>({0}) == nums);
}

int main() {
	::testing::InitGoogleTest();
	return RUN_ALL_TESTS();
}
